<template>
	<view style="height: 100vh;">
		<u-navbar title='驳回报销' :autoBack="true" bgColor="transparent" 
			:placeholder="true"></u-navbar>
		<image src="http://qiniuapplet.jiachuangnet.com/baoxiao.png" style="width:750rpx;height: 490rpx;z-index:1;position: absolute;top:0;left:0">
		</image>
		<view class="container">
			<view v-for="(v,i) in list" :key="i" class="item">
				<!-- <image src='http://sk5hyzd14.hd-bkt.clouddn.com/applet/daifukuan.png' class='statusImg'></image> -->
				<image src='http://qiniuapplet.jiachuangnet.com/yijujue.png' class='statusImg'
					v-if="v.status == 1"></image>
				<view class="flex" style="padding-bottom: 20rpx;">
					<view style="font-size: 30rpx;font-weight: 700;">{{v.storeName}}</view>
					<!-- <u-icon name="arrow-right" color="#BBBBBB"></u-icon> -->
				</view>
				<view class="info" style="font-size: 28rpx;">
					<view class="flex">
						<view>报销类型</view>
						<view>{{v.financeName}}</view>
					</view>
					<view class="flex">
						<view>报销时间</view>
						<view>{{v.createTime}}</view>
					</view>
					<view class="flex">
						<view>报销金额</view>
						<view style="color: #3077FF;font-size: 32rpx;"><text
								style="font-size: 24rpx;margin-right: 10rpx;">¥</text>{{v.money}}</view>
					</view>

					<!-- <view class="flex">
						<view>备注</view>
						<view>{{v.remark}}</view>
					</view> -->
					<view class="remark">
						<view style="display: flex;align-items: center">
							<view style="width: 8rpx;
height: 24rpx;
background: #3077FF;
border-radius: 4rpx;"></view>
							<view style="font-size: 28rpx;margin-left:20rpx;font-weight: 700;">驳回原因</view>
						</view>
						<view style="padding:20rpx 20rpx  0 20rpx;color:#686868">
							{{v.rejectReason||''}}
						</view>
					</view>
				</view>
			</view>

		</view>
		<view class="grace-loading" v-if="isLoadAll">{{ loadingTxt }}</view>
	<!-- 	<view @click="toPath"
			style="width:120rpx;height:120rpx;box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);position: fixed;bottom:50rpx;right:50rpx;z-index:100000;border-radius: 50%;background: #50a1f5;">
			<view style="display:flex;justify-content:center;margin-top: 25rpx;margin-bottom:5rpx;">
				<u-icon name="plus" color="white" size="20"></u-icon>
			</view>
			<view style="text-align: center;font-size: 24rpx;color:white">报销</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				pageNumber:1,
				pageSize:20,
				total: 1, // 总页数
				isLoadAll:false,
				loadingTxt: '加载中...',
			}
		},
		onLoad() {
			this.getReimbursementList()
		},
		onReachBottom(){
			// 判断当前页是否大于等于总页数
			if (this.total <= this.list.length) {
				this.isLoadAll = true;
				this.loadingTxt = '没有更多数据啦~';
			} else {
				this.pageNumber++;
				this.isLoadAll = true;
				this.loadingTxt = '加载中...';
				this.getReimbursementList(); // 每次滑动请求接口，实现上拉加载更多数据
			}
		},
		methods: {
			toPath() {
				uni.navigateTo({
					url: '/pages/reimbursement/add'
				})
			},
			getReimbursementList(){
				let params = {
					pageSize: this.pageSize,
					pageNumber: this.pageNumber,
					status:1
				}
				uni.$u.http.get('/storeLedger/getMyReimbursementRecord', {params}).then(res => {
					this.list = this.list.concat(res.data);
					this.total=res.total
					this.isLoadAll = false;
				})
			}
		},
	}
</script>
<style>
	page {
		height: 100vh;
	}
</style>
<style lang="scss" scoped>
	.container {
		width: 700rpx;
		margin: 0 auto;
		height: calc(100vh - 200rpx);
		position: absolute;
		z-index: 10;
		margin-bottom: 400rpx;
		left: 25rpx;
	}

	.item {
		background-color: white;
		width: 100%;
		border-radius: 20rpx;
		box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
		min-height: 200rpx;
		padding: 20rpx;
		width: calc(100% - 40rpx);
		margin-bottom: 20rpx;
		position: relative;
	}

	.statusImg {
		position: absolute;
		top: 30rpx;
		right: 140rpx;
		width: 106rpx;
		height: 92rpx;
		z-index: 100;
	}

	.flex {
		display: flex;
		justify-content: space-between;
		align-items: center;
	}

	.info {
		border-top: 1rpx solid #eee;
	}

	.info>view {
		margin-top: 20rpx;
	}

	.info>view>view:nth-child(1) {
		color: #666;
	}

	.remark {
		width: 100%;
		background: #E2F2FB;
		padding: 20rpx 0;
		border-radius: 10rpx;
	}
</style>